﻿using System.Collections.Generic;

namespace Tatibah
{
    /// <summary>
    /// The class represents a Page Footer
    /// </summary>
    public class Footer : BaseHeaderFooter
    {
        /// <summary>
        /// Construct a Footer from multiple items. Items can be Paragraphs, NumberedLists and Tables
        /// </summary>
        /// <param name="MultipleItems"></param>
        public  Footer(params iDocumentAppend[] MultipleItems)
        {
            foreach (iCellAppend item in MultipleItems)
            {
                if (item.GetType() == typeof(Paragraph))
                {

                    HeaderFooterContent content = new HeaderFooterContent((Paragraph)item);
                    contents.Add(content);
                }
                else if (item.GetType() == typeof(Table))
                {
                    HeaderFooterContent content = new HeaderFooterContent((Table)item);
                    contents.Add(content);
                }
                else if (item.GetType() == typeof(NumberedList))
                {
                    HeaderFooterContent content = new HeaderFooterContent((NumberedList)item);
                    contents.Add(content);
                }
            }
        }

      


        /// <summary>
        /// Append Multiple Items to a Footer. Items can be Paragraphs, NumberedLists and Tables
        /// </summary>
        /// <param name="MultipleItems"></param>
        public void Append(params iDocumentAppend[] MultipleItems)
        {
            foreach (iCellAppend item in MultipleItems)
            {
                if (item.GetType() == typeof(Paragraph))
                {

                    HeaderFooterContent content = new HeaderFooterContent((Paragraph)item);
                    contents.Add(content);
                }
                else if (item.GetType() == typeof(Table))
                {
                    HeaderFooterContent content = new HeaderFooterContent((Table)item);
                    contents.Add(content);
                }
                else if (item.GetType() == typeof(NumberedList))
                {
                    HeaderFooterContent content = new HeaderFooterContent((NumberedList)item);
                    contents.Add(content);
                }
            }
        }


        /// <summary>
        /// Append mutilpe strings
        /// </summary>
        /// <param name="MultipleItems"></param>
        public void Append(params string[] MultipleItems)
        {
            foreach (string item in MultipleItems)
            {
                Paragraph p = new Paragraph(item);
                HeaderFooterContent content = new HeaderFooterContent(p);
                contents.Add(content);
            }
        }
    }
}
